﻿Ext.define('Egitim.view.tanimlar.KullaniciList', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.kullanicilist',
    store: 'Kullanici',
	projeId: '',
	
	initComponent: function (){		
		var me = this;
		
		me.selModel = {
		    selType: 'checkboxmodel'
		    , mode: 'MULTI'
		};
		
		me.dockedItems = [{
	        dock: 'top',
	        xtype: 'toolbar',
	        items: [
	        {
	            glyph: 61,
	            xtype: 'button',
				handler: function () {
					this.up('panel').down('#searchform').setVisible(true);
				}
	        }, {
	            xtype: 'form',
				itemId: 'searchform',
				layout: 'hbox',
				border: false,
				hidden: true,
				defaultType: 'textfield',
				items: [{
					fieldLabel: 'Ad',
					name: 'username',
					tip:'searchUserName'
				},{
					fieldLabel: 'Eposta',
					name: 'eposta',
					tip:'searchUserName'
				}]
	        }]
	    },{
	        xtype: 'pagingtoolbar',
	        store: 'Kullanici',
	        dock: 'bottom',
	        displayInfo: true
	    }];
		
        me.callParent();
		me.addEvents('silkullanici', 'guncellekullanici');
	},
	
	selectable: false, //seçim içinse true
	features: [{ftype:'grouping'}],
	columns: [
        { text: 'Ad',  dataIndex: 'username', flex: 1},
        { text: 'E-Posta', dataIndex: 'eposta' },
        { text: 'Oluşturuldu', dataIndex: 'created'},
		{
            xtype:'actioncolumn',
            width:50,
            items: [
            {
                icon: 'egitimapp/resources/icons/edit.png',  // Use a URL in the icon config
                tooltip: LBL_GUNCELLE,
                handler: function(grid, rowIndex, colIndex) {
                    var rec = grid.getStore().getAt(rowIndex);
					grid.up('kullanicilist').fireEvent('guncellekullanici', grid, rec);
                }
            },
            {
                icon: 'egitimapp/resources/icons/delete.gif',
                tooltip: 'Sil',
                handler: function(grid, rowIndex, colIndex) {
                    var rec = grid.getStore().getAt(rowIndex);
					grid.up('kullanicilist').fireEvent('silkullanici', grid, rec);
                }
            }]
        }		
    ]
    
});